The following is a list of all the binary operators and their
usages:
Binary Operators |
Symbol |
Example |
Explanation |
1 |
2 |
exponentiation |
3 |
4 |
multiplication |
5 |
6 |
division |
8 |
9 |
* modulo |
10 |
11 |
addition |
12 |
13 |
subtraction |
14 |
15 |
equality |
16 |
17 |
inequality |
18 |
19 |
* bitwise AND |
20 |
21 |
* bitwise exclusive OR |
22 |
23 |
* bitwise inclusive OR |
24 |
25 |
* logical AND |
26 |
27 |
* logical OR |
28 |
29 |
* ternary operation |
(*) Starred explanations indicate that the operator requires
integer arguments.
Logical AND () and OR (||) short-circuit the way they do in C.
That is, the second operand is not evaluated if the first is
false; the second || operand is not evaluated if the first is true.
The ternary operator evaluates its first argument (a). If it is
true (non-zero) the second argument (b) is evaluated and returned,
otherwise the third argument (c) is evaluated and returned.